//
//  EnterpriseGuideService.m
//  homeland
//
//  Created by Alawn on 13-11-15.
//  Copyright (c) 2013年 xzysun. All rights reserved.
//

#import "EnterpriseGuideService.h"
#import "CommonWorkGuideEntity.h"
#import "WorkQueryCell.h"
#import "WorkQuerySelectEntity.h"
#import "EnterpriseWorkEntity.h"
@implementation EnterpriseGuideService
-(id)init
{
    self = [super init];
    if (self) {
        _dataItemName = @"CommonWorkGuideEntity";
    }
    return self;
}
-(void)loadDataWithKey:(NSString *)keyOrNil
{
    _currentPageNo = 1;//刷新或查询的时候将请求页码变为1
    if (self.dataList) {
        self.dataList = nil;
    }
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"respectiveIssue"];
    } else {
        [params setValue:@"" forKey:@"respectiveIssue"];
    }
    EnterpriseWorkEntity *item = (EnterpriseWorkEntity *)self.dataItem;
//    [params setValue:item.categoryCode forKey:@"categoryCode"];
//    [params setValue:item.ztsxfl forKey:@"ztsxfl"];
//    [params setValue:item.sjfl forKey:@"sjfl"];
//    [params setValue:item.tddx forKey:@"tddx"];
//    [self doHttpPost:SERVER_URL_GE_GUIDE headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
    [params setValue:item.businessName forKey:@"unitName"];
    [params setValue:nil forKey:@"serverType"];
    [self doHttpPost:SERVER_URL_GE_GUIDE headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
}

-(void)loadMoreDataWithKey:(NSString *)keyOrNil
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (keyOrNil) {
        [params setValue:keyOrNil forKey:@"respectiveIssue"];
    } else {
        [params setValue:@"" forKey:@"respectiveIssue"];
    }
    EnterpriseWorkEntity *item = (EnterpriseWorkEntity *)self.dataItem;
    //    [params setValue:item.categoryCode forKey:@"categoryCode"];
    //    [params setValue:item.ztsxfl forKey:@"ztsxfl"];
    //    [params setValue:item.sjfl forKey:@"sjfl"];
    //    [params setValue:item.tddx forKey:@"tddx"];
    //    [self doHttpPost:SERVER_URL_GE_GUIDE headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
    [params setValue:item.businessName forKey:@"unitName"];
    [params setValue:nil forKey:@"serverType"];
    [self doHttpPost:SERVER_URL_GE_GUIDE headers:nil path:[NSString stringWithFormat:@"/%d",_currentPageNo] parameters:params];
}

-(void)configCell:(UITableViewCell *)cell atIndex:(NSIndexPath *)index
{
    CommonWorkGuideEntity *item = [self.dataList objectAtIndex:index.row];
    WorkQueryCell *tempCell = (WorkQueryCell *)cell;
    [self configInfoWithEnterpriseGuidCell:tempCell withItem:item atIndex:index.row];
}

-(CGFloat)heightForCellAtRow:(NSIndexPath *)index
{
    return 64.0f;
}
@end
